#ifndef MEDICALRECORDVIEWWIDGET_H
#define MEDICALRECORDVIEWWIDGET_H

#include <QWidget>
#include <QJsonObject>
#include <QJsonArray>
#include "../../../Common/models.h"
#include "../../../Common/protocol.h"

namespace Ui {
class MedicalRecordViewWidget;
}

class MedicalRecordViewWidget : public QWidget {
    Q_OBJECT
    
public:
    explicit MedicalRecordViewWidget(const Patient& patient, QWidget *parent = nullptr);
    ~MedicalRecordViewWidget();
    
private slots:
    void on_refreshButton_clicked();
    void onViewDetailClicked();
    void onChatWithDoctorClicked();
    void onMessageReceived(MessageType type, const QJsonObject& data);
    
private:
    void loadMedicalRecords();
    void updateRecordTable(const QJsonArray& records);
    
    Ui::MedicalRecordViewWidget *ui;
    Patient m_patient;
    QJsonArray m_records;
};

#endif // MEDICALRECORDVIEWWIDGET_H

